$(function() {
	var userinfo = $.cookie("userinfo");
	if(userinfo!=null&&""!=userinfo){
		var array = userinfo.split("§");
		$("#operatorCode").val(array[0]);
		$("#password").val(array[1]);
		$("#mindpwd").attr('checked','true');
	}
	$("#loginBtn").click(function(){
		$('#loginForm').form('submit', {
			url : js+'system/loginOperator.action',
			onSubmit : function() {
				//记住密码
				 if($("#mindpwd").attr("checked")){
					 $.cookie("userinfo",$("#operatorCode").val()+"§"+$("#password").val(),{expires: 30,path:'/'});
				 }else{
					 $.cookie("userinfo",null,{path:'/'});
				 }
				return $(this).form('validate');
			},
			success : function(data) {
				var result = eval('(' + data + ')');
				if(result.success=='1'){
					var location = js+"main.action";
					window.location=location;
				}else if(result.success=='0'){
					$.messager.alert('提示：',result.msg,'error');
				}
				
			}
		});
	})
	

})
